package com.question_barrier.vo.user;

import com.question_barrier.entity.User;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
@ApiModel("排行榜列表")
public class UserRankList {
    @ApiModelProperty("用户自身排名")
    private long userRank;
    @ApiModelProperty("排名数据")
    private List<UserRankData> userRankDataList = new ArrayList<UserRankData>();

    @Data
    public static class UserRankData{
        @ApiModelProperty("用户昵称")
        private String name;
        @ApiModelProperty("用户积分")
        private long integral;
        @ApiModelProperty("用户头像url")
        private String photoUrl;

        public UserRankData(User user){
            this.name = user.getName();
            this.integral = user.getIntegral();
            this.photoUrl = user.getPhotoUrl();
        }
    }
}
